<?php

class NotificationsService {

	function get() {
		global $_SGLOBAL;
		$uId = $_SGLOBAL['supe_uid'];
		$notify = $result = array();
		$result = array(
			'notification'   => array(
				'unread' => 0 ,
				'mostRecent' => 0
			)
		);

		//通知
		$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('notification')."  WHERE uid='$uId' AND new='1' ORDER BY id DESC");
		$i = 0;
		while($value = $_SGLOBAL['db']->fetch_array($query)) {
			$i++;
			if(!$result['notification']['mostRecent']) $result['notification']['mostRecent'] = $value['dateline'];
		}
		$result['notification']['unread'] = $i;

		return $result;
	}

}